package com.mxx.common.netty.http;

import com.mxx.common.conv.JacksonConverter;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpResponseStatus;

import java.io.Serializable;


/**
 * @Auther: Mr. Zeng
 * @Date: 2020/8/3 17:24
 * @Description: 暂无描述
 */
public class DefaultNettyHttpResponseFactory extends AbstractNettyHttpResponseFactory {


    public DefaultNettyHttpResponseFactory(JacksonConverter jacksonConverter, NettyHttpResponseTemplate template) {
        super(jacksonConverter, template);
    }

    @Override
    public NettyHttpResponse withJson(Serializable serializable) {
        return this.newResponse(HttpResponseStatus.OK, serializable).withJson();
    }

    @Override
    public NettyHttpResponse withJson(String content) {
        return this.newResponse(HttpResponseStatus.OK, content).withJson();
    }

    @Override
    public NettyHttpResponse withImage(ByteBuf byteBuf) {
        return this.newResponse(HttpResponseStatus.OK, byteBuf).withImage();
    }

    @Override
    public NettyHttpResponse withHtml(String html) {
        return this.newResponse(HttpResponseStatus.OK, html).withHtml();
    }


}
